<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
</head>
<body>
<script type="text/javascript" src="inheritClass.js"></script>
<script type="text/javascript" src="klass.js"></script>
<script type="text/javascript">
//    var Parent = function(name) {
//        this.name = name || "no name";
//    };
//    Parent.prototype.sayName = function() {
//        alert(this.name);
//    };
//    var Child = function(name) {};
//    inherit(Child, Parent);
//    var child = new Child("tim");
//    child.sayName();

    //综合牛B的继承方式
    var Man = klass(null, {
        _construct: function(name){
            this.name = name;
        },
        getName: function() {
            return this.name;
        }
    });
    var SuperMan = klass(Man, {
        _construct: function(age){
            console.log("Super Man");
            this.age = age;
        },
        getSuperName: function() {
            return "Super " + this.name;
        }
    });

    var s = new SuperMan("tim");
    alert(s.name);
</script>
</body>
</html>